/* ================================================================================
//	Crypteviant!
//	Providing tough encrypted P2P Chat
//	Copyright (C) 2010  Martin Pfeifer, Tobias Rausch
//
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
// ============================================================================== */

#ifndef TESTTIMER_HPP
#define TESTTIMER_HPP

#include <QtCore/QObject>
#include <QtTest/QtTest>
#include <QtTest/QSignalSpy>
#include <QtCore/QList>
#include <QtCore/QVariant>

#include "timerfactory.hpp"
#include "abstracttimer.hpp"


using namespace Timer;

/**
 * @brief Unit Test class for Timers
 *
 * @class TestTimer testtimer.hpp "testtimer.hpp"
*/
class TestTimer : public QObject
{
    Q_OBJECT

private:
    /**
     * @brief Instanciate a new Timer and check the startup state
     *
     * @fn instanciateTimer() const
     * @return AbstractTimer*
    */
    void checkInitialTimerState(AbstractTimer *timer) const;

    /**
     * @brief Delete the Timer and checks if this has worked
     * @details Should return a NULL pointer on success
     *
     * @fn cleanupTimer(AbstractTimer*) const
     * @arg AbstractTimer*
    */
    void cleanupTimer(AbstractTimer *timer) const;

private slots:
    /**
     * @brief Test the class TimerFactory
     * @details This will test if the factory returns a valid Timer object
     *
     * @fn testFactory()
    */
    void testFactory();

    /**
     * @brief Test the class AbstractTimer (1): Autostart after construction
     * @details This test will create a new Timer object and will stop it after running the constructor.\n
     * No manual call to \ref AbstractTimer::start() will be done.
     *
     * @fn testStoppingAfterConstructing()
    */
    void testStoppingAfterConstructing();

    /**
     * @brief Test the class AbstractTimer (2): Manually starting and stopping
     * @details This test will create a new Timer object. Afterwards start() will be manually called.\n
     * After some time the Timer will be stopped calling \ref AbstractTimer::stop() and evaluate the data.
     *
     * @fn testManualStartingStopping()
    */
    void testManualStartingStopping();

    /**
     * @brief Test the class AbstractTimer (3): Automatically reset Timer on start
     * @details This test will check if all values are correctly reset after a new call to \ref AbstractTimer::start()
     *
     * @fn testTimerResetOnStart()
    */
    void testTimerResetOnStart();

    /**
     * @brief Test the class AbstractTimer (4): Manually resetting the Timer
     * @details This test case checks if all values of the Timer are correctly reset after calling \ref AbstractTimer::reset()
     *
     * @fn testTimerResetManually()
    */
    void testTimerResetManually();

};

#endif // TESTTIMER_HPP
